<template>
	<view class="clearfix overflow-x-hidden">
		<block v-if="order.dingdzt != '3'">
			<view style="color: #ffffff;">
				<p>1</p>
			</view>
			<button @click="buczl" type="primary" style="width: 90%;">补充资料</button>
		</block>

		<uni-section class="pub-title" title="订单详情" type="line"></uni-section>

		<uni-card class="card-pub" :title="carInfo.name" :isShadow="true">
			<uni-row>
				<uni-col :span="24">
					订 单 号: {{order.dingdbh}}
				</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span="24">
					下单时间: {{order.createTime}}
				</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span="24">
					车辆名称: {{order.kuybOrderPolicyList[0].chelmc}}
				</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span="12">
					初登日期: {{order.kuybOrderPolicyList[0].chudrq}}
				</uni-col>
				<uni-col :span="12">
					行驶里程: {{order.kuybOrderPolicyList[0].xingslc}} 公里
				</uni-col>
			</uni-row>
		</uni-card>

		<uni-card class="font-bold-title" title="核心保障" mode="title" :extra="hexbz" note="Tips" :isShadow="true">
			<uni-row class="block-margin">
				<uni-col :span="12">
					赔付限额
				</uni-col>
				<uni-col :span="12">
					<view class="clearfix text-right" decode="true">{{order.kuybOrderPolicyList[0].peifxe}}&nbsp;万
					</view>
				</uni-col>
			</uni-row>
			<uni-row v-if="order.kuybTaocList.length > 0">
				<uni-col :span="12">
					会员福利
				</uni-col>
				<uni-col class="text-right" :span="12">
					<view class="clearfix text-right">
						<uni-row class="text-right opacity8 margin10B" v-for="(item,index) in order.kuybTaocList">
							{{item.xiangmmc}}, {{item.shuom}}
						</uni-row>
					</view>
				</uni-col>
			</uni-row>

			<template v-slot:footer>
				<view>
					<uni-row>
						<uni-col :span="12" class="marign10T">
							售价
						</uni-col>
						<uni-col :span="12">
							<view class="clearfix text-right" decode="true">
								<span class="font-orange-num">{{order.dingdje / 100}}&nbsp;元</span>
							</view>
						</uni-col>
					</uni-row>
				</view>
			</template>
		</uni-card>

		<uni-section class="pub-title" title="会员信息" type="line"></uni-section>
		<uni-card class="box-shadow-10 card-pub">
			<uni-forms-item label="姓名" name="name">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].beibxr" placeholder="请输入姓名"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
			<uni-forms-item label="手机号码" name="mobile">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].beibxrlxdh" placeholder="请输入手机号码"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
			<uni-forms-item label="身份证号" name="zhengjhm">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].beibxrsfz" placeholder="请输入身份证号"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
			<uni-forms-item label="电子邮箱" name="email">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].beibxryx" placeholder="接收电子保单用"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
		</uni-card>

		<uni-section class="pub-title" title="车辆信息" type="line"></uni-section>
		<uni-card class="box-shadow-10 card-pub">
			<uni-forms-item label="车牌号" name="cheph">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].bebxcph" placeholder="请输入车牌号"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
			<uni-forms-item label="车架号" name="chejh">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].chejh" placeholder="请输入车架号"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
			<uni-forms-item label="发动机号" name="fadjh">
				<uni-easyinput type="text" v-model="order.kuybOrderPolicyList[0].fadjh" placeholder="请输入发动机号"
					:inputBorder="true" disabled="true" />
			</uni-forms-item>
		</uni-card>
		
		<uni-row v-if="order.dingdzt == '2' || order.dingdzt == '3'">
			<uni-col :span="12">
				<button @click="openPdf" class="btn-red">查看会员服务合同</button>
			</uni-col> 
			<uni-col :span="12">
				<button @click="sendEmail" class="btn-red">发送合同到邮箱</button>
			</uni-col>
		</uni-row>

		<!-- <view style="color: #ffffff;">
			<p>1</p>
			<p>1</p>
			<p>1</p>
		</view> -->

	</view>
</template>

<script>
	export default {
		data() {
			return {
				order: uni.getStorageSync("selectedOrder"),
			}
		},
		methods: {
			buczl() {
				uni.navigateTo({
					url: "../../pages2/toubrxx/toubrxx"
				})
			},
			
			openPdf: function(form) {
				let that = this
			
				uni.navigateTo({
					url: "../../pages2/pdfViewer/pdfViewer"
				})
			},

			sendEmail: function(form) {
				let that = this
				
				uni.request({
					url: getApp().globalData.serviceUrl + "/order/kuybOrder/sendEmail",
					data: {
						orderId: that.order.id
					},
					header: {
						"X-Access-Token": uni.getStorageSync("token")
					},
					method: 'GET',
					dataType: 'json',
					success: (resp) => {
						if (resp.data.success) {
							uni.showToast({
								title: resp.data.result,
								icon: 'none'
							});
						
						}
					}
				});

			}
		}
	}
</script>

<style>

</style>
